{% if section and section.type == "header" %}
  {% assign section = section %}
{% else %}
  {% assign section = theme_config.global.sections.header %}
{% endif %}
{% assign router = section.router | default : routes.current_route %}
{% if section.settings.is_index_board and router == "index/index" and section.settings.is_board %}
  {% assign showBoard = true %}
{% elsif section.settings.is_index_board == false and section.settings.is_board %}
  {% assign showBoard = true %}
{% else %}
  {% assign showBoard = false %}
{% endif %}

{% assign data = section.settings %}

{% get_nav nav_id={section.settings.nav.id} %}
{% assign header_nav = nav %}
{% if showBoard %}
  <div id="top-bar" style="--bg-color: {{ data.board_bg }}; --text-color: {{ data.board_font }};">
    <div class="top-bar-top">
      <div class="container_wrapper md:grid">
        <div class="md:flex items-center hidden">
          {% include 'share_link',color:data.board_font,section:data %}
        </div>
        <div>
          <a href="{{ data.board_link.url }}">{{data.board_text}}
          </a>
          <span class="board_more cursor-pointer inline-flex items-center gap-3 ml-4">
            <span class="md:inline-block hidden">{{data.board_more_text}}</span>
            {% include 'svg',svg: 'board_icon' %}
          </span>
        </div>
        <div class="header_currency md:flex items-center justify-end hidden">
          {% if data.is_currency %}
            {% include 'currency',color: board_font,position: 'bottom',is_currency_flag: data.is_currency_flag %}
          {% endif %}
        </div>

      </div>
    </div>
    <div class="boare_more_content">
      <div class="container_wrapper">
        <div class="board_close flex items-center justify-end">
          <span class="flex cursor-pointer">
            {% include 'svg',svg: 'boaed_close_icon' %}
          </span>
        </div>
        <div class="boare_more_text flex flex-col gap-8">
          {% if data.board_more_subtitle != '' %}
            <div class="board_subtitle">{{data.board_more_subtitle}}</div>
          {% endif %}
          {% if data.board_more_title != '' %}
            <div class="boare_title public_title">{{data.board_more_title}}</div>
          {% endif %}
          {% if data.board_more_detail != '' %}
            <div class="board_detail">{{data.board_more_detail}}</div>
          {% endif %}
          {% if data.board_more_btn_text != '' %}
            <div class="board_btn">
              <a href="{{data.board_more_btn_link | setUrlDataFrom:data_from}}" class="public_btn">{{data.board_more_btn_text}}</a>
            </div>
          {% endif %}
        </div>
      </div>
    </div>

  </div>
{% endif %}


{% include 'oem_header',data: data, header_nav: header_nav,blocks: section.blocks,router: router %}

{% include 'mobile_nav',data: data,header_nav: header_nav %}

{% include 'header_search',color: data.menu_color,search_text: data.search_placeholder %}


<script>
  $(function() {
    $(`#top-bar .board_more`).on('click', function() {
      $(this).toggleClass('open_more')
      $(`#top-bar .boare_more_content`).slideToggle(300)
    })
    $(`#top-bar .board_close`).on('click', function() {
      $(`#top-bar .board_more`).removeClass('open_more')
      $(`#top-bar .boare_more_content`).slideUp(300)
    })
  })
</script>

{% schema %}
{
	"tag": "",
	"class": "header",
	"is_global": true,
	"name": {
		"zh_CN": "头部",
		"en_US": "Header"
	},
	"settings": [
		{
			"type": "card_header",
			"label": {
				"zh_CN": "菜单导航设置",
				"en_US": "Menu Navigation Settings"
			}
		},
		{
			"type": "card_nav",
			"label": {
				"zh_CN": "选择菜单",
				"en_US": "Select menu"
			},
			"default": {
				"id": "",
				"title": ""
			},
			"id": "nav"
		},
		{
			"type": "card_select",
			"label": {
				"zh_CN": "导航样式",
				"en_US": "Navigation style"
			},
			"default": "type1",
			"id": "nav_type",
			"option": [
				{
					"label": {
						"zh_CN": "显示more link",
						"en_US": "Show more link"
					},
					"value": "type1"
				},
				{
					"label": {
						"zh_CN": "显示所有导航",
						"en_US": "Show all navigation"
					},
					"value": "type2"
				}
			]
		},
		{
			"type": "card_header",
			"label": {
				"zh_CN": "公告栏",
				"en_US": "Bulletin board"
			}
		},
		{
			"type": "card_switch",
			"label": {
				"zh_CN": "开启公告栏",
				"en_US": "Turn on the bulletin board"
			},
			"id": "is_board",
			"default": true
		},
		{
			"type": "card_switch",
			"label": {
				"zh_CN": "仅首页显示公告栏",
				"en_US": "Display bulletin board only on home page"
			},
			"id": "is_index_board"
		},
		{
			"type": "card_input",
			"label": {
				"zh_CN": "公告栏文案",
				"en_US": "Bulletin board copy"
			},
			"id": "board_text",
			"default": "We Free Shipping Worldwide."
		},
		{
			"type": "card_page_link",
			"label": {
				"zh_CN": "公告栏链接",
				"en_US": "Bulletin board link"
			},
			"default": {
				"type": "",
				"title": "",
				"url": ""
			},
			"id": "board_link"
		},
		{
			"type": "card_input",
			"label": {
				"zh_CN": "公告栏查看更多",
				"en_US": "Bulletin board view more"
			},
			"id": "board_more_text",
			"default": "More"
		},
		{
			"type": "card_input",
			"label": {
				"zh_CN": "公告栏副标题",
				"en_US": "Bulletin board subtitle"
			},
			"id": "board_more_subtitle",
			"default": "New Arrival Products"
		},
		{
			"type": "card_input",
			"label": {
				"zh_CN": "公告栏标题",
				"en_US": "Bulletin board title"
			},
			"id": "board_more_title",
			"default": "New Arrival Products"
		},
		{
			"type": "card_text_editor",
			"label": {
				"zh_CN": "公告栏描述",
				"en_US": "Bulletin board description"
			},
			"id": "board_more_detail",
			"default": "Pair text with an image to focus on your chosen product, collection, or blog post. Include information about availability, style, or even a review."
		},
		{
			"type": "card_input",
			"label": {
				"zh_CN": "公告栏按钮文字",
				"en_US": "Bulletin board button text"
			},
			"id": "board_more_btn_text",
			"default": "SHOP NOW"
		},
		{
			"type": "card_page_link",
			"label": {
				"zh_CN": "公告栏按钮链接",
				"en_US": "Bulletin board button link"
			},
			"default": {
				"type": "",
				"title": "",
				"url": ""
			},
			"id": "board_more_btn_link"
		},
		{
			"type": "card_header",
			"label": {
				"zh_CN": "顶部LOGO与图片",
				"en_US": "Top LOGO and image"
			}
		},
		{
			"type": "card_image",
			"label": {
				"zh_CN": "pc端logo图片",
				"en_US": "Logo image on PC"
			},
			"id": "pc_logo_pic",
			"default": ""
		},
		{
			"type": "card_slider",
			"label": {
				"zh_CN": "pc端logo图片宽度",
				"en_US": "Logo image width on PC"
			},
			"id": "pc_logo_w",
			"max": "400",
			"unit": "px",
			"min": "0",
			"default": 60
		},
		{
			"type": "card_image",
			"label": {
				"zh_CN": "移动端logo图片",
				"en_US": "Mobile logo image"
			},
			"id": "wap_logo_pic",
			"default": ""
		},
		{
			"type": "card_slider",
			"label": {
				"zh_CN": "移动端logo图片宽度",
				"en_US": "Mobile logo image width"
			},
			"id": "wap_logo_w",
			"max": "200",
			"unit": "px",
			"min": "0",
			"default": 60
		},
		{
			"type": "card_switch",
			"label": {
				"zh_CN": "个人中心",
				"en_US": "Personal center"
			},
			"id": "is_member",
			"default": "1"
		},
		{
			"type": "card_switch",
			"label": {
				"zh_CN": "货币切换",
				"en_US": "Currency switch"
			},
			"id": "is_currency",
			"default": "1"
		},
		{
			"type": "card_switch",
			"label": {
				"zh_CN": "货币前展示国旗",
				"en_US": "Display the national flag in front of the currency"
			},
			"id": "is_currency_flag",
			"default": "1"
		},
		{
			"type": "card_switch",
			"label": {
				"zh_CN": "搜索",
				"en_US": "Search"
			},
			"id": "is_search",
			"default": "1"
		},
		{
			"type": "card_input",
			"label": {
				"zh_CN": "搜索底纹",
				"en_US": "Search shading"
			},
			"id": "search_placeholder",
			"default": "Search..."
		},
		{
			"type": "card_header",
			"label": {
				"zh_CN": "颜色设置",
				"en_US": "Color Settings"
			}
		},
		{
			"type": "card_color",
			"label": {
				"zh_CN": "公告栏字体",
				"en_US": "Bulletin board font"
			},
			"id": "board_font",
			"default": "#333"
		},
		{
			"type": "card_color",
			"label": {
				"zh_CN": "公告栏背景",
				"en_US": "Bulletin board background"
			},
			"id": "board_bg",
			"default": "#fff"
		},
		{
			"type": "card_color",
			"label": {
				"zh_CN": "导航栏背景",
				"en_US": "Navigation bar background"
			},
			"id": "nav_bg",
			"default": "#f6e5d1"
		},
		{
			"type": "card_color",
			"label": {
				"zh_CN": "菜单项字体",
				"en_US": "Menu item font"
			},
			"id": "menu_color",
			"default": "#000"
		},
		{
			"type": "card_header",
			"label": {
				"zh_CN": "SNS账号",
				"en_US": "SNS account"
			}
		},
		{
			"type": "card_switch",
			"label": {
				"zh_CN": "Facebook",
				"en_US": "Facebook"
			},
			"id": "is_facebook"
		},
		{
			"type": "card_switch",
			"label": {
				"zh_CN": "Twitter",
				"en_US": "Twitter"
			},
			"id": "is_twitter"
		},
		{
			"type": "card_switch",
			"label": {
				"zh_CN": "Pinterest",
				"en_US": "Pinterest"
			},
			"id": "is_pinterest"
		},
		{
			"type": "card_switch",
			"label": {
				"zh_CN": "Instagram",
				"en_US": "Instagram"
			},
			"id": "is_instagram"
		},
		{
			"type": "card_switch",
			"label": {
				"zh_CN": "Snapchat",
				"en_US": "SnaPChat"
			},
			"id": "is_snapchat"
		},
		{
			"type": "card_switch",
			"label": {
				"zh_CN": "Tiktok",
				"en_US": "Tiktok"
			},
			"id": "is_tiktok"
		},
		{
			"type": "card_switch",
			"label": {
				"zh_CN": "Tumblr",
				"en_US": "Tumblr"
			},
			"id": "is_tumblr"
		},
		{
			"type": "card_switch",
			"label": {
				"zh_CN": "Linkedin",
				"en_US": "Linkedin"
			},
			"id": "is_linkedin"
		},
		{
			"type": "card_switch",
			"label": {
				"zh_CN": "Youtube",
				"en_US": "Youtube"
			},
			"id": "is_youtube"
		},
		{
			"type": "card_switch",
			"label": {
				"zh_CN": "Vimeo",
				"en_US": "Vimeo"
			},
			"id": "is_vimeo"
		},
		{
			"type": "card_switch",
			"label": {
				"zh_CN": "VK",
				"en_US": "VK"
			},
			"id": "is_vk"
		},
		{
			"type": "card_switch",
			"label": {
				"zh_CN": "Whatsapp",
				"en_US": "Whatsapp"
			},
			"id": "is_whatsapp"
		}
	],
	"blocks": [],
	"default": {
		"settings": {
			"nav": {
				"id": "",
				"title": ""
			},
			"nav_type": "type1",
			"is_board": true,
			"is_index_board": false,
			"board_text": "We Free Shipping Worldwide.",
			"board_link": {
				"type": 0,
				"title": "",
				"url": "",
				"source_id": ""
			},
			"board_more_text": "More",
			"board_more_subtitle": "UP TO 50% OFF",
			"board_more_title": "New Arrival Products",
			"board_more_detail": "Pair text with an image to focus on your chosen product, collection, or blog post. Include information about availability, style, or even a review.",
			"board_more_btn_text": "SHOP NOW",
			"board_more_btn_link": {
				"type": 0,
				"title": "",
				"url": "",
				"source_id": ""
			},
			"pc_logo_pic": {
				"src": "",
				"alt": ""
			},
			"pc_logo_w": 60,
			"wap_logo_pic": {
				"src": "",
				"alt": ""
			},
			"wap_logo_w": 60,
			"is_member": true,
			"is_currency": true,
			"is_currency_flag": false,
			"is_search": true,
			"board_font": "#fff",
			"board_bg": "#121212",
			"nav_bg": "#fff",
			"search_placeholder": "Search...",
			"menu_color": "#121212",
			"is_facebook": true,
			"is_twitter": true,
			"is_pinterest": true,
			"is_instagram": true,
			"is_snapchat": true,
			"is_tiktok": false,
			"is_tumblr": false,
			"is_linkedin": false,
			"is_youtube": false,
			"is_vimeo": false,
			"is_vk": false,
			"is_whatsapp": false
		},
		"blocks": []
	}
}
{% endschema %}